Repository navigation
test: move tests to the tests/ directory - #20
Merged
Merged
Conversation
Move the inline #[cfg(test)] modules into integration tests under tests/ (one file per module) with a shared TempRepo helper in tests/common. Add src/lib.rs exposing the modules so the tests can reach them, and make the helpers they exercise public (Repo::root, changed_ranges, rgb_to_256, delete_last_word, truncation helpers). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
#[cfg(test)] mod testsout ofsrc/into Rust's standardtests/directory:tests/git.rs,tests/diff.rs,tests/ui.rs,tests/app.rs,tests/theme.rs, plustests/common/mod.rswith the sharedTempRepohelper.src/lib.rsexposing the modules (integration tests can only use a library's public API);src/main.rsnow uses thegitratlib.Repo::root(),diff::changed_ranges,theme::rgb_to_256,app::delete_last_wordand theuitruncation helpers. The push test now adds the remote via plaingitinstead of the privateRepo::run.No behavior change; the same 21 tests run.
Test plan
cargo fmt --all -- --checkcargo clippy --all-targets --all-features -- -D warningscargo test(21 passed)🤖 Generated with Claude Code
Note
Low Risk
Test and project-structure refactor only; no changes to TUI or git command behavior beyond widening a few APIs for tests.
Overview
Refactors the crate so integration tests live under
tests/(git,diff,ui,app,theme) with sharedTempRepointests/common/mod.rs, instead of inline#[cfg(test)]blocks insrc/.Adds
src/lib.rsand wiresmain.rsthrough thegitratlibrary. Test-only helpers arepub:Repo::root(),diff::changed_ranges,theme::rgb_to_256,app::delete_last_word, and the UI truncation/scroll helpers. The push integration test adds remotes viaTempRepo::gitrather than privateRepo::run.CLAUDE.mddocuments the lib/binary split and the external test layout. No runtime behavior change — the same 21 tests exercise the same logic.Reviewed by Cursor Bugbot for commit 931b8f6. Bugbot is set up for automated code reviews on this repo. Configure here.